<template>
	<view class="content" :style="{
		'padding-top':height+'px'
	}">
		<view :style="{
			'height':statusBarHeight+'px' 
		}">

		</view>
		<view class="head" :style="{
			'top':statusBarHeight+'px'
		}">
			<view class="head_left">
				<u-icon name="arrow-left" color="#444444" size="24" :bold="true" @click="toBack"></u-icon>
			</view>
			<view class="text">大成学堂</view>
			<view class="head_right">
				<collect></collect>
			</view>
		</view>

		<view class="box">

			<view class="detail_item">
				<view class="detail_left">
					<image src="@/static/images/pic_sy_jinrigengxin.png" mode=""></image>
				</view>
				<view class="detail_right">
					<view class="title">
						巴蜀风土人情解析
					</view>
					<view class="content_t">
						带你领略不一样的风土人情
					</view>
					<view class="num">
						1920人正在学习
					</view>
				</view>
			</view>
			<view class="box_title">
				学习进度(2/10)
			</view>
			<template v-for="(val,index) in studyList">
				<u-collapse :border="false">

					<u-collapse-item title="文档指南" name="Docs guide">
						<view slot="title" class="u-page__item__title__slot-title head1">
							<view class="head1_left">
								<view class="title1">
									<view class="renew_view" v-if="val.renew">

									</view>
									{{val.name}}
									<text class="renew_text" v-if="val.renew">更新</text>
								</view>
								<view class="text1">
									#人物
								</view>
							</view>
							<view :class="`head1_right${val.studyStatus}`">
								{{val.studyText}}
							</view>

						</view>
						<!-- <text class="u-collapse-content">涵盖uniapp各个方面，给开发者方向指导和设计理念，让您茅塞顿开，一马平川</text> -->
						<view style="padding-bottom: 24rpx;" v-for="(item,index) in list"
							@click="toDetail(item.type_text)">
							<view class="box_item" :style="{
							background:val.studyStatus==0?'#F7F8FA':bacMapping[item.live_id-1].background,
							'border-radius':'16rpx'
						}">
								<!-- <text>1 巴蜀人物概述</text>
					  		<view class="">
					  			
					  		</view> -->
								<view class="itme_left">
									<text
										:class="val.studyStatus == 0?'left_content':'left_content1'">{{item.name}}</text>
									<view class="left_type" :class="'type_' + item.type">
										{{item.type_text}}
									</view>
								</view>
								<view class="item_right" v-if="val.studyStatus != 0"
									:class="item.live_id == 1 ? 'right_type_0':'right_type_1'">
									{{bacMapping[item.live_id-1].text}}
								</view>
							</view>
						</view>

					</u-collapse-item>
				</u-collapse>
			</template>
		</view>
		<u-action-sheet :actions="list" :title="''" :show="show"></u-action-sheet>

		<!-- <view class="btn_box">
			<view class="btn">
				参与课程
			</view>
		</view> -->
		<floatingBall></floatingBall>
	</view>
</template>

<script>
	import collect from '@/components/collect.vue' // 收藏、
	export default {
		components: {
			collect
		},
		data() {
			return {
				statusBarHeight: 0,
				height: 0,
				show:false,
				studyList: [{
					studyStatus: 0,
					name: '巴蜀地区概述',
					renew: false,
					studyText: '已学习'
				}, {
					studyStatus: 1,
					name: '巴蜀地区概述',
					renew: false,
					studyText: '继续学习'
				}, {
					studyStatus: 2,
					name: '巴蜀地区概述',
					renew: false,
					studyText: '开始学习'
				}, {
					studyStatus: 2,
					name: '巴蜀地区概述',
					renew: true,
					studyText: '开始学习'
				}],
				list: [{
					name: '1 巴蜀人物概述',
					type: 0,
					type_text: '图文',
					live_id: 1
				}, {
					name: '1 巴蜀人物概述',
					type: 1,
					type_text: '视频',
					live_id: 2
				}, {
					name: '1 巴蜀人物概述',
					type: 2,
					type_text: '音频',
					live_id: 3
				}, {
					name: '1 巴蜀人物概述',
					type: 2,
					type_text: '音频',
					live_id: 4
				}, {
					name: '1 巴蜀人物概述',
					type: 2,
					type_text: '音频',
					live_id: 5
				}, {
					name: '1 巴蜀人物概述',
					type: 2,
					type_text: '音频',
					live_id: 6
				}],
				bacMapping: [{
					id: 1,
					background: '#F7F8F',
					text: '免费',
					color: '#55B877'
				}, {
					id: 2,
					background: 'linear-gradient(to right, #F7F8FA 0%,#F7F8FA 50%, #8CD7A3 100%)',
					text: '元气驿站',
					color: '#fff'
				}, {
					id: 3,
					background: 'linear-gradient(to right, #F7F8FA 0%,#F7F8FA 50%, #FABC81 100%)',
					text: '启初梦谷',
					color: '#fff'
				}, {
					id: 4,
					background: 'linear-gradient(to right, #F7F8FA 0%,#F7F8FA 50%, #CFA5E3 100%)',
					text: '青空天台',
					color: '#fff'
				}, {
					id: 5,
					background: 'linear-gradient(to right, #F7F8FA 0%,#F7F8FA 50%,#7EC6FF 100%)',
					text: '无极云顶',
					color: '#fff'
				}, {
					id: 6,
					background: 'linear-gradient(to right, #F7F8FA 0%,#F7F8FA 50%, #6C87D0 100%)',
					text: '返朴归真',
					color: '#fff'
				}]
			}
		},
		created() {
			const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度


			this.statusBarHeight = statusBarHeight.statusBarHeight;
			this.$nextTick(() => {
				uni.createSelectorQuery().select('.head').boundingClientRect(data => {
					this.height = data.height;
				}).exec()
			});
		},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			toDetail(text) {
				console.log('texttext', text);
				if (text === '音频') {
					uni.navigateTo({
						url: "/pages/bigResult/myResult_au"
					})
				} else {
					// if (text === '图文') {
						uni.navigateTo({
							url: "/pages/bigResult/myResult_it"
						})
					// } 
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		box-sizing: border-box;
	}

	.head {
		width: 100%;
		padding: 18rpx 30rpx 47rpx;
		position: fixed;
		display: flex;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
		z-index: 99;

		.head_left {
			position: absolute;
			left: 30rpx;

		}

		.head_right {
			position: absolute;
			right: 30rpx;
		}

		.text {
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: 400;
			color: #444444;
		}
	}

	.head1 {
		width: 100%;
		background: #F7F8FA;
		border-radius: 16rpx;
		padding: 8rpx 0;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.head1_left {

			.title1 {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #444444;
				display: flex;
				align-items: center;

				.renew_view {
					width: 16rpx;
					height: 16rpx;
					background: #EE6060;
					border-radius: 50%;
					margin-right: 16rpx;
				}

				.renew_text {
					font-size: 26rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #EE6060;
					margin-left: 16rpx;
				}
			}

			.text1 {
				font-size: 26rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #ADADAD;
				margin-top: 16rpx;
			}
		}

		.head1_right0 {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #888888;
		}

		.head1_right1 {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #55B877;
		}

		.head1_right2 {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #444444;
		}


	}

	/deep/ .u-cell__body {
		background: #F7F8FA !important;
	}

	/deep/ .u-collapse-item__content__text {
		padding: 0 !important;
	}

	/deep/ .u-collapse-item__content {
		margin-top: 24rpx;
		margin-bottom: 24rpx;
		padding: 0 !important;
	}

	.box {
		width: 100%;
		padding: 0 30rpx;
		box-sizing: border-box;

		.box_title {
			font-size: 34rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #444444;
			padding: 40rpx 0 32rpx;
		}

		.detail_item {
			width: 100%;
			padding: 32rpx 30rpx;
			box-sizing: border-box;
			display: flex;
			background: #F7F8FA;

			.detail_left {
				width: 210rpx;
				height: 210rpx;
				border-radius: 8rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.detail_right {
				flex: 1;
				padding: 16rpx 32rpx;
				box-sizing: border-box;

				.title {
					font-size: 32rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #444444;
				}

				.content_t {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #ADADAD;
					margin-top: 16rpx;
				}

				.num {
					font-size: 26rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #888888;
					margin-top: 37rpx;
				}
			}
		}
	}

	.btn_box {
		width: 100%;
		height: 128rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		padding: 16rpx 30rpx;
		box-sizing: border-box;

		.btn {
			height: 96rpx;
			background: linear-gradient(360deg, #50B674 0%, #AEDDBD 100%);
			border-radius: 48rpx 48rpx 48rpx 48rpx;
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}


	.box_item {
		width: 100%;
		background: #F7F8FA;
		padding: 0 32rpx;
		height: 108rpx;
		border-radius: 16rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		// margin-top: 24rpx;
		.itme_left {
			font-size: 30rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			color: #444444;
			display: flex;
			align-items: center;

			.left_content {
				font-size: 30rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #ADADAD;
			}

			.left_content1 {
				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #444444;
			}

			.left_type {
				padding: 4rpx 10rpx;
				font-size: 24rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				margin-left: 16rpx;
				border-radius: 4rpx;
			}

			.type_0 {
				background: rgba(153, 187, 255, 0.302);
				color: #99BBFF;
			}

			.type_1 {
				background: rgba(201, 153, 255, 0.302);
				color: #C999FF;
			}

			.type_2 {
				background: rgba(255, 182, 94, 0.302);
				color: #FFB65E;
			}

		}

		.item_right {
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			margin-right: 52rpx;
		}

		.right_type_0 {
			color: #55B877;
		}

		.right_type_1 {
			color: #fff;
		}
	}
</style>